package com.zzptc.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.PreparedStatement;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.zzptc.x.dao.UserDao;
import com.zzptc.x.entity.Users;

public class UserUpdateServlet extends HttpServlet {

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		System.out.println("udpate");
		String id=request.getParameter("id");
		System.out.println("id:"+id);
		UserDao dao=new UserDao();
		List<Users>list=null;
		
		try {
			list=dao.getAll();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		Users u1=null;
		for(int i=0;i<list.size();i++){
			Users u=list.get(i);
			String idd=u.getEu_user_id();
			if(idd.equals(id)){
				u1=u;
				break;
			}
		}
		HttpSession session=request.getSession();
		session.setAttribute("user", u1);
		
		request.getRequestDispatcher("manager/user-modify.jsp").forward(request,response);
		
	}
protected void dOPost(HttpServletRequest resp)
throws SecurityException,IOException{

}
}

